import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import Components from 'unplugin-vue-components/vite'
// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

const pathSrc = path.resolve(__dirname, 'src')

// https://vitejs.dev/config/
export default defineConfig({
  // base:'./',
  // cacheDir: 'C:/hcbk/web/vite',
  resolve: {
    alias: {
      '~/': `${pathSrc}/`,
    },
  },
  css: {
    // preprocessorOptions: {
    //   scss: {
    //     additionalData: `@use "~/styles/element/index.scss" as *;`,
    //   },
    // },
  },
  server:{
    host:'localhost.baikehuicai.com',
    port: 8082,
    proxy:{
      '/umc':{
        target: 'http://localhost.baikehuicai.com:9090',
        changeOrigin: true,
      },
      '/api/product':{
        target: 'http://baikehuicai.com',
        changeOrigin: true,
      },
      '/business': {
        target: 'http://localhost.baikehuicai.com:9090',
        changeOrigin: true,
      },
      '/umc/user':{
        target: 'http://localhost.baikehuicai.com:9090',
        changeOrigin: true,
      },
      '/file':{
        target: 'http://adminweb.baikehuicai.com',
        changeOrigin: true,
      },
      '/product':{
        target: 'http://localhost.baikehuicai.com:9090',
        changeOrigin: true,
      },
    }
  },
  plugins: [
    vue(),
    Components({
      // resolvers: [
      //   ElementPlusResolver(),
      // ],
      dts: path.resolve(pathSrc, 'components.d.ts'),
    }),
  ],
})
